package com.ctbu.tourism.controller.restful;


import com.ctbu.tourism.entity.Result;
import com.ctbu.tourism.service.SeniorityService;
import com.ctbu.tourism.utils.ResultUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author xiaolen
 * time:2018/4/12 15:03
 */
@RestController
public class SeniorityController {
    @Autowired
    private SeniorityService seniorityService;

    @RequestMapping(value = "/seniority/integral", method = RequestMethod.GET)
    Result getSeniorityIntegral()
    {
        Object object = seniorityService.getSeniorityIntegral();
        if(object != null){
            return ResultUtil.success(object);
        }else {
            return ResultUtil.error(null);
        }
    }

    @RequestMapping(value = "/seniority/newnumber", method = RequestMethod.GET)
    Result getSeniorityNewnumber()
    {
        Object object = seniorityService.getSeniorityNewnumber();
        if(object != null){
            return ResultUtil.success(object);
        }else {
            return ResultUtil.error(null);
        }
    }

    @RequestMapping(value = "/seniority/sumnumber", method = RequestMethod.GET)
    Result getSenioritySumnumber()
    {
        Object object = seniorityService.getSenioritySumnumber();
        if(object != null){
            return ResultUtil.success(object);
        }else {
            return ResultUtil.error(null);
        }
    }

}
